package directory.controller;

import controller.*;
import java.sql.ResultSet;
import java.util.Vector;
import directory.model.PersonRelationType;

public class PersonRelationTypeMgr extends DbManager {
    public static final PersonRelationTypeMgr mgr = new PersonRelationTypeMgr();
    
    private PersonRelationTypeMgr() {
        super( "PersonRelationType" );
        m_titles = new String[]{"DE", "NOMBRE", "HACIA" };
    }

    @Override
    protected PersonRelationType getBean() {
        return new PersonRelationType();
    }

    @Override
    public PersonRelationType getItem( String id ) {
        return (PersonRelationType) super.getItem( id );
    }
    
    @Override
    @SuppressWarnings("unchecked")
    protected void addObject( Vector v, ResultSet rs ) {
        v.add( new PersonRelationType( rs ) );
    }
    
    public synchronized Vector<PersonRelationType> getListFromA( String idPersonType ) {
        return executeQuery( "select * from PersonRelationType where idPersonTypeA=" + idPersonType + " order by name" );
    }
    public synchronized Vector<PersonRelationType> getListToB( String idPersonType ) {
        return executeQuery( "select * from PersonRelationType where idPersonTypeB=" + idPersonType + " order by name" );
    }
}